// import { reject, resolve } from "core-js/fn/promise"

const request = (url="", date={}, method='', header={} ) => {
    return new Promise((resolve, reject) => {
        uni.request({
            method: method,
            url: url,
            date: date,
            header: header,
            dataType: 'json'
        }).then((response) => {
            setTimeout(function () {
                uni.hideLoading();
            }, 200);
            let [error, res] = response;
            resolve(res.data);
        }).catch(error => {
            let [err, res] = error;
            reject(err);
        })
    });
}

export default request;